package com.myway.dto.flight.domain;

import java.util.HashMap;

public enum SeasonType {

	L("L"),//淡季
	K("K"),//平季
	H("H"),//旺季
	P("P");//风季
	
	private final String alias;
	private static HashMap<String, SeasonType> map;

	/**
	 * Construct the hash map at load time
	 */
	static {
		map = new HashMap<String, SeasonType>();
		for (SeasonType type : SeasonType.values()) {
			map.put(type.alias, type);
		}
	}

	SeasonType(String alias) {
		this.alias = alias;
	}

	@Override
	public String toString() {
		return this.alias;

	}

	/**
	 * Return a <code>TripType</code> object holding the value of specified alias name
	 * @param alias the alias name of the type
	 * @return a <code>TripType</code> object holding the value represented by the alias name argument
	 */
	public static SeasonType valueOfAlias(String alias) {
		SeasonType type = map.get(alias);

		if (type == null) {
			throw new IllegalArgumentException("Unknown trip type alias [" + alias + "]");
		}

		return type;
	}
	
}
